import type { AddressItem, Logistics, OrderDetail, OrderPre } from '@/types/order'
import { request } from '@/utils/request'

// 获取药品订单预支付信息
// 获取药品订单预支付信息
export const getMedicalOrderPre = (params: { prescriptionId: string }) =>
  request<OrderPre>('/patient/medicine/order/pre', 'GET', params)

// 获取地址列表()
export const getAddressList = () => request<AddressItem[]>('/patient/order/address', 'GET')

// 生成药品订单接口
export const createMedicalOrder = (pramas: { id: string; couponId: string; addressId: string }) =>
  request<{ id: string }>('/patient/medicine/order', 'POST', pramas)

// 获取药品订单详情
export const getMedicalOrderDetail = (orderId: string) =>
  request<OrderDetail>(`/patient/medicine/order/detail/${orderId}`, 'GET')

// 获取物流详情
export const getMedicalOrderLogistics = (id: string) =>
  request<Logistics>(`/patient/order/${id}/logistics`, 'GET')
